<?php

import('Form.~');
import('Form.Element.Fieldset');
import('Form.Element.InputText');
import('Form.Element.Textarea');
import('Form.Element.InputSubmit');
import('Form.Element.InputReset');


class FormContact extends Hoa_Form {

	/**
	 * FormContact::__construct()
	 *
	 */
	public function __construct ( ) {

		/**
		 * On définit notre action.
		 */
		parent::__construct('#');

		$fieldset = new Hoa_Form_Element_Fieldset('Envoyer un message');

		$fieldset->addElements(array(
			'nom'          => array(
				'type'      => Hoa_Form::ELEMENT_INPUT_TEXT,
				'attribute' => array(
					'id'    => 'nom',
					'name'  => 'nom',
					'class' => 'ui-corner-all'
				),
				'validator' => array(
					'Empty',
					'Alpha'
				),
				'label'     => 'Nom :'
			),
			'prenom'          => array(
				'type'      => Hoa_Form::ELEMENT_INPUT_TEXT,
				'attribute' => array(
					'id'    => 'prenom',
					'name'  => 'prenom',
					'class' => 'ui-corner-all'
				),
				'validator' => array(
					'Empty',
					'Alpha'
				),
				'label'     => 'Prénom :'

			),
			'email'          => array(
				'type'      => Hoa_Form::ELEMENT_INPUT_TEXT,
				'attribute' => array(
					'id'    => 'email',
					'name'  => 'email',
					'class' => 'ui-corner-all'
				),
				'validator' => array(
					'Empty'
				),
				'label'     => 'Email :'
			),
			'texte'          => array(
				'type'      => Hoa_Form::ELEMENT_TEXTAREA,
				'attribute' => array(
					'id'    => 'texte',
					'name'  => 'texte',
					'rows'  => 10,
					'cols'  => 135,
					'class' => 'ui-corner-all'
				),
				'validator' => array(
					'Empty',
					'StringLength' => array(
						'min'      => 2,
						'max'      => 32
					)
				),
				'label'     => 'Texte :'
			)
		));

		/**
		 * On crée le bouton de soumission.
		 */
		$submit = new Hoa_Form_Element_InputSubmit('login');
		$reset = new Hoa_Form_Element_InputReset('reset');

		$fieldset->addElement($submit);
		$fieldset->addElement($reset);

		$this->addElement($fieldset);


	}
}